<template>
	<view>
		<view class="data-box">
			<view class="form-block">
				<view class="card">
					<view class="card-body">
						<u--form
						class="from-card"
						labelPosition="left"
						labelWidth="130"
						:model="info"
						ref="ruleForm">
							<u-form-item
							label="车牌号"
							prop="carNum"
							borderBottom>
								<u--input
								disabled
								disabledColor="#ffffff"
								suffixIcon="arrow-right"
								v-model="info.carNum"
								placeholder="请选择"
								inputAlign="right"
								border="none">
								</u--input>
							</u-form-item>
							<u-form-item
							label="检查日期"
							prop="checkDate"
							required
							borderBottom>
								<u--input
								disabled
								disabledColor="#ffffff"
								v-model="info.checkDate"
								inputAlign="right"
								border="none">
								</u--input>
							</u-form-item>
							<u-form-item label="检查人" prop="userName" required borderBottom>
								<u--input
								disabled
								disabledColor="#ffffff"
								v-model="info.userName"
								inputAlign="right"
								border="none"
								></u--input>
							</u-form-item>
							<u-form-item label="外观是否正常" prop="appearance" required borderBottom>
								<u-radio-group
								v-model="info.appearance"
								iconPlacement="left"
								shape="square">
									<u-radio
									disabled
									:customStyle="{marginLeft: '40rpx'}"
									v-for="(item, index) in whether"
									:key="index"
									:label="item.name"
									:name="item.name">
									</u-radio>
								</u-radio-group>
							</u-form-item>
							<u-form-item label="内饰环境是否正常" prop="interior" required borderBottom>
								<u-radio-group
								v-model="info.interior"
								iconPlacement="left"
								shape="square">
									<u-radio
									disabled
									:customStyle="{marginLeft: '40rpx'}"
									v-for="(item, index) in whether"
									:key="index"
									:label="item.name"
									:name="item.name">
									</u-radio>
								</u-radio-group>
							</u-form-item>
							<u-form-item label="油表是否正常" prop="oilGauge" required borderBottom>
								<u-radio-group
								v-model="info.oilGauge"
								iconPlacement="left"
								shape="square">
									<u-radio
									disabled
									:customStyle="{marginLeft: '40rpx'}"
									v-for="(item, index) in whether"
									:key="index"
									:label="item.name"
									:name="item.name">
									</u-radio>
								</u-radio-group>
							</u-form-item>
							<u-form-item label="备注" prop="remark" borderBottom labelWidth="80">
								<u--textarea
								disabled
								v-model="info.remark" >
								</u--textarea>
							</u-form-item>
						</u--form>
					</view>
				</view>
			</view>
			
			<uni-group v-if="imageList.length>0">
				<u--form
				class="from-card"
				labelPosition="top"
				labelWidth="180">
					<u-form-item label="图片">
						<u-upload
							:fileList="imageList"
							:multiple="true"
							:maxCount="imageList.length"
							:disabled="true"
							:deletable="false">
						</u-upload>
					</u-form-item>
				</u--form>
			</uni-group>
		</view>
		
		<!-- <view class="submit-button">
			<view class="submit-block">
				<view class="submit-block_item" @click="sheetShow = true">操作</view>
			</view>
		</view>
		<u-action-sheet title="操作" round="20" :actions="list" :show="sheetShow" @close="sheetShow = false" @select="sheetSelect"></u-action-sheet> -->
	</view>
</template>

<script>
	import { getcheckCarInfo, checkCarDel } from '@/api/checkCar'
	export default {
		data() {
			return {
				info:{},
				whether:[
					{ name:'是' },
					{ name:'否' },
				],
				imageList:[],
				list:[
					{
						name: '编辑检查',
					},
					{
						name: '删除检查',
					}
				],
				sheetShow: false,
				// cljcId:''
			}
		},
		onLoad(option) {
			// this.cljcId = option.id
			this.getInfo(option.id)
		},
		onShow() {
		},
		methods: {
			async getInfo(id){
				const { data } = await getcheckCarInfo(id);
				if(data.code == 200){
					this.info = data.data
					this.imageList = []
					if(data.data.images!=''){
						data.data.images.split(',').forEach(e=>{
							this.imageList.push({url:e})
						})
					}
				}
			},
			doAction(){
				this.sheetShow = true
			},
			sheetSelect(e){
				if(e.name == '删除检查'){
					let that_ = this
					uni.showModal({
						title: "是否确定？",
						content: "是否确定删除检查",
						confirmText: '是',
						cancelText: '否',
						success:  res => {
							if (res.confirm){
								that_.delete(that_.info.id)
								uni.navigateBack()
							}
						}
					})
				}else if(e.name == '编辑检查'){
					this.gotoPage('/subPackTask/work/scgl/cljc/edit?id='+this.info.id)
				}
			},
			async delete(id){
				const { data } = await checkCarDel(id)
				if(data.code == 200){
					uni.showToast({ title: '车辆检查删除成功', icon: 'none' })
				}else{
					uni.showToast({ title: '车辆检查删除失败', icon: 'none' })
				}
			}
		}
	}
</script>

<style>
	page{
		background-color: #f6f6f6;
		color: #333333;
	}
</style>
